﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using csvviewer.contracts;

namespace csvviewer.logic
{
    public class Format_page
    {
        public Format_page(Prepend_line_index prepend, 
						   Parse_lines parse, 
						   Normalize_columns normalize, 
						   Format_table toTable)
        {
            _process = prepend.Process;
			prepend.Page += parse.Process;
            parse.Page += normalize.Process;
			normalize.Page += toTable.Process;
            toTable.Table += _ => this.Table(_);
        }


        private readonly Action<PageOfLines> _process; 
        public void Process(PageOfLines page) { _process(page); }

        public event Action<IEnumerable<string>> Table;
    }
}
